package com.zhiyou100.controller.activity;

import com.zhiyou100.dao.Impl.ActivityDaoImpl;
import com.zhiyou100.emtity.Activity;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @description:
 * @author: 马跃
 * @create: 2021-01-21 08:58
 **/
@WebServlet("/activityQuery")
public class ActivityQueryServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        int id = Integer.parseInt(request.getParameter("id"));
        Activity list = new ActivityDaoImpl().query(id);
        request.getSession().setAttribute("user", list);
        request.getRequestDispatcher("./serve/apartmentDetails.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
